//
//  MediaShareCommunity.h
//  MediaShareBB
//
//  Created by Artak Gevorgyan on 5/23/13.
//  Copyright (c) 2013 InnoriseEntertainment. All rights reserved.
//

#import <Foundation/Foundation.h>

//#import "MediaShareBB.h"
#import "MediaShareBBConstants.h"

// Forward declerations
@class MediaShareData;
@class MediaShareCommunity;

/**
 * Delegate of the MediaShareCommunity, informs about various events
 */
@protocol MediaShareCommunityDelegate <NSObject>

-(UIViewController*) targetViewController;
-(void) loginSuccess;
-(void) loginCanceled;
-(void) loginFailedWithError:(NSError*) error;
-(void) communityViewWillClose;
-(void) entitiesFetchedForCommunity:(MediaShareCommunity*) comm;
-(void) entitiesSelectedForCommunity:(MediaShareCommunity*) comm;
-(void) willSharingMedia:(MediaShareData*) data through:(MediaShareCommunity*) comm;
-(void) didFinishSharingMedia:(MediaShareData*) data through:(MediaShareCommunity*) comm;
-(void) didFailedSharingMedia:(MediaShareData*) data through:(MediaShareCommunity*) comm
					withError:(NSError*) error;

@end

@interface MediaShareCommunity : NSObject


@property Boolean isNativeMode;


/// This delegation must be used to be notified about the MediaShareCommunity
/// related events
@property (nonatomic, assign) id<MediaShareCommunityDelegate> delegate;

/// MediaShareCommunity name 
@property (nonatomic, strong) NSString* name;

/// MediaShareCommunity type
@property (nonatomic, assign) enum MediaShareCommunities communityType;

/// Supported sharing media types. Collection with MEDIA_TYPE values
@property (nonatomic, strong) NSArray* supportedMediaTypes;

/// All entities of media share community
@property (nonatomic, strong) NSMutableArray* entities;

/// Selected entities of media share community
@property (nonatomic, strong) NSMutableArray* selectedEntities;

/*
 * Constructor
 */
-(id) init;

/*
 * Virtual method to get community description. 
 * Implementation in subclass
 */
-(NSString*) description;

/*
 * Virtual method to configure community with given credentials. 
 * Implementation in subclass
 */
-(void) configureWithCredentials:(NSDictionary*) credentials;

/*
 * Virtual method to login in community. Implementation in subclass
 */
-(void) login;

/*
 * Virtual method for getting username. Implementation in subclass
 */
-(NSString*) getUserName;

/*
 * Virtual method for getting shared media link. Implementation in subclass
 */
-(NSString*) sharedMediaLink;

/*
 * Virtual method to log out from community. Implementation in subclass
 */
-(void) loginWithAnotherUser;

/*
 * Virtual method to show community's friends picker view on the given view controller. 
 * Implementation in subclass
 */
-(void) showFriendsPickerOnView:(UIViewController*) vc;

/*
 * Virtual method to share media with given MediaShareData object
 * Implementation in subclass
 **/
-(void) shareMedia:(MediaShareData*) data;

/*
 * Checks is given media type is supported in community
 **/
-(BOOL) isValidMediaType:(enum MediaTypes) mediaType;

@end
